package tempo.timing;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class MainWindow extends TabActivity
{
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Resusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, AddRider.class);
		spec = tabHost.newTabSpec("addRider").setIndicator("Add rider").setContent(intent); // res.getDrawable(R.drawable.ic_tab_artists)
		tabHost.addTab(spec);

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, StartActivity.class);
		spec = tabHost.newTabSpec("start").setIndicator("Start").setContent(intent); // res.getDrawable(R.drawable.ic_tab_artists)
		tabHost.addTab(spec);

		// Do the same for the other tabs
		intent = new Intent().setClass(this, FinishActivity.class);
		spec = tabHost.newTabSpec("finish").setIndicator("Finish").setContent(intent); // res.getDrawable(R.drawable.ic_tab_albums)
		tabHost.addTab(spec);

		intent = new Intent().setClass(this, ResultActivity.class);
		spec = tabHost.newTabSpec("result").setIndicator("Result").setContent(intent); // res.getDrawable(R.drawable.ic_tab_songs)
		tabHost.addTab(spec);

		tabHost.setCurrentTab(0);
		Race.getCurrent().setContext(this);
		LoadJson();
	}

	private void LoadJson()
	{
		Race.getCurrent().LoadJson();
	}
}